//1.引入vue-router和vue
import VueRouter from "vue-router";
import Vue from "vue";

//2.使用路由
Vue.use(VueRouter);

const Home = () => import('views/home/Home.vue');
const Profile = () => import('views/profile/Profile.vue');
const Category = () => import('views/category/Category');
const Shoppingcart = () => import('views/shoppingcart/Shoppingcart');
const Detail = () => import('views/detail/Detail');

const routes = [
  {
  path: "",
  redirect: "/home",
},
  {
    path: "/home",
    component: Home,
  },
  {
    path: "/category",
    component: Category,
  },
  {
    path: "/shoppingcart",
    component: Shoppingcart,
  },
  {
    path: "/profile",
    component: Profile,
  },
  {
    path: "/detail/:iid",
    component: Detail,
  }
];
//3.创建vueRouter对象
const vueRouter = new VueRouter({
  routes: routes,
  mode: "history",
});
//4.导出vueRouter
export default vueRouter;
